/**
 * 地址选择器
 */
angular
.module('myApp')
.directive('locationPicker', function() {
  return {
      restrict: 'AE',
      replace: true,
      require: 'ngModel',
      template: '<input type="text" />',
      link: function ($scope, element, attrs, ngModel) {

        $(element).on('change', function(event) {
          $scope.location = event.target.value;
        });

        $(element)
          .val($scope.location)
          .cityPicker();
      }
  };
});
